<!-- 查询 content 列表 -->
{{ $contentSQL :="* FROM content WHERE status in(1,2) and categoryID=? order by status desc,sortNo desc" }}
{{ $categorySQL := "* FROM category WHERE id=? and status<3 order by status desc, sortNo desc"}}


{{ if eq .userType 1}}
  {{ $contentSQL ="* FROM content WHERE categoryID=? order by sortNo desc" }}
  {{ $categorySQL = "* FROM category WHERE id=? order by sortNo desc"}}
{{end}}

{{ $selectList := selectList "content" .q .pageNo 20 $contentSQL .UrlPathParam }}

{{ $nav := selectOne "category" $categorySQL .UrlPathParam }}
{{ $site:=site }}
<!DOCTYPE html>
<html lang="zh-cn">
<head>
  <title>{{ $nav.Name }}</title>
  <meta name="description" content="{{ $nav.Description }}" />
  <meta name="keyword" content="{{ $nav.Keyword }}" />

{{template "bodystart.html"  }}
					<header class="page-header" aria-label="页面">
			
			<h1 class="page-title">
				{{$nav.Name}}			</h1>

					</header>


					{{ range $k,$v := $selectList.Data }}	

					<article id="{{$v.Id}}" class="{{$v.Id}} post type-post status-publish format-standard hentry category-uncategorized" itemtype="https://schema.org/CreativeWork" itemscope>
						<div class="inside-article">
										<header class="entry-header">
									<h2 class="entry-title" itemprop="headline"><a href="{{basePath}}{{ trimPrefixSlash $v.Id}}" rel="bookmark">{{$v.Title}}</a></h2>		
									<div class="entry-meta">
								<span class="posted-on">
									<time class="entry-date published" datetime="{{ slice .UpdateTime 0 10 }}" itemprop="datePublished">{{ slice $v.UpdateTime 0 10 }}</time></span> 
									<span class="byline">
										 <span class="author vcard" itemprop="author" itemtype="https://schema.org/Person" itemscope><a class="url fn n" href="{{basePath}}{{ trimSlash .CategoryID }}" title="查看{{ $v.CategoryName }}栏目的所有文章" rel="author" itemprop="url"><span class="author-name" itemprop="name">{{ $v.CategoryName }}</span></a></span></span> 		</div>
										</header>
								
								<div class="entry-summary" itemprop="text">
									 {{ .Summary }} &#8230; <a title="{{$v.Title}}" class="read-more" href="{{basePath}}{{ trimPrefixSlash $v.Id}}" aria-label="Read more about xuperchian">阅读更多</a>
								</div>
							</div>
					</article>
					{{end}}




{{if gt $selectList.Page.PageCount 1}}
<nav id="nav-below" class="paging-navigation" aria-label="归档页面">
	<div class="nav-links">
	{{$currPageNo := $selectList.Page.PageNo}}
	{{if lt $currPageNo 1}}
	  {{$currPageNo = 1}}
	{{end}}
	{{if gt $currPageNo $selectList.Page.PageCount }}
	   {{$currPageNo = $selectList.Page.PageCount}}
	{{end}}
  
	{{if gt $currPageNo 1}}

	  <a class="prev page-numbers" href="{{basePath}}{{ trimSlash .UrlPathParam}}/page/{{ addInt $currPageNo -1 }}?q={{.q}}"><span aria-hidden="true">&larr;</span> 上一页</a>

	{{end}}


	{{ range $index, $value := (seq 1 $selectList.Page.PageCount) }}
		{{ if eq $currPageNo $value }}
		<span aria-current="page" class="page-numbers current"><span class="screen-reader-text">页面</span>{{$value}}</span>
		{{else}}
		<a class="page-numbers" href="{{basePath}}{{ trimSlash $.UrlPathParam}}/page/{{$value}}"><span class="screen-reader-text">页面</span>{{$value}}</a>
		{{end}}  
	{{ end }}

	{{if lt $currPageNo $selectList.Page.PageCount}}
	  <a class="next page-numbers" href="{{basePath}}{{ trimSlash $.UrlPathParam}}/page/{{ addInt $currPageNo 1 }}">下一页 <span aria-hidden="true">&rarr;</span></a>
	  {{end}}  
	</div>		
</nav>
{{end}}
{{template "bodyend.html" }}